// 格式化筛选条件
function formatCondition() {
    if (Object.keys(params).length > 0) {
        const placeholders = [];
        const tempParams = [];

        var cols = []
        let mapCols = {}
        TABLE_STRUCT.forEach(item => {
            if (item.is_query == 1) {
                cols.push(item.column_name)
                if (item.field_name) {
                    mapCols[`${item.field_name}`] = item.column_name
                }
            }
        })


        // 将存在别名的params转换
        let coverParams = {}
        Object.keys(params).forEach(item => {
            if (mapCols[item]) {
                coverParams[mapCols[item]] = params[item]
            } else {
                coverParams[item] = params[item]
            }
        })

        Object.keys(coverParams).forEach(key => {
            let col_name = camelToUnderscore(key)
            if (cols.includes(col_name)) {
                var row = {}
                TABLE_STRUCT.find(item => {
                    if (item.column_name == col_name) {
                        row = item
                    }
                })

                if (coverParams[key]) {
                    placeholders.push(`${col_name} ${sql_operator[row.query_type]} ?`);
                    if (row.query_type == "LIKE") {
                        tempParams.push('%' + coverParams[key] + '%');
                    } else {
                        tempParams.push(coverParams[key]);
                    }

                }
            }
        })

        return {
            placeholders: placeholders.join(' AND '),
            tempParams: tempParams,
        }
    }
}